//
//  AVOSBase.m
//  FunnyVideo
//
//  Created by 李鑫 on 15/9/11.
//  Copyright © 2015年 NewEggTech. All rights reserved.
//

#import "AVOSBase.h"

#import <AVOSCloud/AVOSCloud.h>


@implementation AVOSBase

- (id)init{
    self = [super init];
    
    if(self)
    {
        self.titles = @[@"全部",@"逗死你",@"国内",@"精选",@"微热门",@"国外",@"排行",@"奇葩"];
    }
    
    return self;
}
/*
 AVOSVideoTypeBest,
 AVOSVideoTypeRank,
 AVOSVideoTypeDomestic,
 AVOSVideoTypeForeign,
 AVOSVideoTypeFunnyyou,
 AVOSVideoTypeWXHot,
 AVOSVideoTypeFlower,
 */

- (NSString *)enumCategoryToString:(AVOSVideoType)type{
    switch (type) {
        case AVOSVideoTypeBest:
            return @"精选";
            break;
        case AVOSVideoTypeRank:
            return @"排行";
            break;
        case AVOSVideoTypeDomestic:
            return @"国内";
            break;
        case AVOSVideoTypeForeign:
            return @"国外";
            break;
        case AVOSVideoTypeFunnyyou:
            return @"逗死你";
            break;
        case AVOSVideoTypeWXHot:
            return @"微热门";
            break;
        case AVOSVideoTypeFlower:
            return @"奇葩";
            break;
        default:
            return @"全部";
            break;
    }
}

- (AVOSVideoType )categoryStringToEnum:(NSString *)str_type{
    if([str_type isEqualToString:@"精选"])
        return AVOSVideoTypeBest;
    else if([str_type isEqualToString:@"排行"])
        return AVOSVideoTypeRank;
    else if([str_type isEqualToString:@"国内"])
        return AVOSVideoTypeDomestic;
    else if([str_type isEqualToString:@"国外"])
        return AVOSVideoTypeForeign;
    else if([str_type isEqualToString:@"逗死你"])
        return AVOSVideoTypeFunnyyou;
    else if([str_type isEqualToString:@"微热门"])
        return AVOSVideoTypeWXHot;
    else if([str_type isEqualToString:@"奇葩"])
        return AVOSVideoTypeFlower;
    else
        return AVOSVideoTypeAll;
}
- (NSUInteger)indexOfVideoType:(AVOSVideoType)videoType{
    
    return [self.titles indexOfObject:[self enumCategoryToString:videoType]];
}
 
@end
